package com.fz.us.oa.core.dao.com.impl;

import com.fz.us.admin.base.dao.impl.BaseDaoImpl;
import com.fz.us.oa.core.dao.com.NoticeReadDao;
import com.fz.us.oa.core.entity.com.NoticeRead;
import org.springframework.stereotype.Repository;
import org.springframework.util.Assert;

import java.util.List;

/**
 * Created by ZhuChunXiao on 2017/7/21.
 */
@Repository
public class NoticeReadDaoImpl extends BaseDaoImpl<NoticeRead, String> implements NoticeReadDao {
    @Override
    public List<NoticeRead> findUsersByNoticeRead(String userId, String noticeId) {
        Assert.notNull(userId, "userId is required");
        Assert.notNull(noticeId, "keyId is required");
        String hql = "from NoticeRead where creater.id = :userId and notice.id=:noticeId";
        List<NoticeRead> noticeReadList = getSession().createQuery(hql).setParameter("userId", userId).setParameter("noticeId", noticeId).list();
        return noticeReadList;
    }
}
